home *** CD-ROM | disk | FTP | other *** search
- Path: news.ichange.com!newsmaster
- From: cmahoney@readysoft.es (Colin Mahoney)
- Newsgroups: comp.lang.c++
- Subject: Re: Random dice program problem need help!!!!!
- Date: Fri, 16 Feb 1996 21:07:47 GMT
- Organization: AT&T Interchange Online Network
- Message-ID: <4g2rvd$41t@ias2.ichange.com>
- References: <4fqum6$pbj@news.bellglobal.com> <4fvo8n$jed@news.halcyon.com>
- NNTP-Posting-Host: 194.179.34.247
- X-Newsreader: Forte Free Agent 1.0.82
-
- normanb@halcyon.com (Norm Bryar) wrote:
-
- >rchartra@feldspar.com (Ron Chartrand) wrote:
-
- >>I am using Borland C 4.52 i have been trying to make a callable
- >>routine to simulate rolling 3 six sided dice but it always comes out
- >>to be the same number?? need help!!!!!
-
- >>//3d6 dice roll
- >>void Threed6()
- >>{
- >>randomize();
- >>dice1=0;
- >>dice2=0;
- >>dice3=0;
-
- >>dice1=rand()%6+1;
- >>dice2=rand()%6+1;
- >>dice3=rand()%6+1;
- >>Total=dice1+dice2+dice3;
- >>}
-
- >>just Email me at rchartra@feldspar.com
-
- >I'm not a Borland officianado, but one usually seeds the random number
- >generator with some "random" value at the beginning, say, of program
- >execution. Usually one uses the time for the seed.
-
- > srand( (unsigned)time( NULL ) ); in MSVC
-
- >Does Borland's randomize() not accept a parameter for the seed value?
-
- randomize() uses a time value as a seed . Is the clock on your
- computer OK? If time() always returns the same value, that would
- explain your problem
-
- > --Norm
-
-
-
-
- ---------------------------------------
- Colin Mahoney ( cmahoney@readysoft.es )
- Sabadell, Spain
- ---------------------------------------
-
-